package version1;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class oracle {
    //定义数据库基本属性：私有化静态属性 类直接调取属性
    private static String url;
    private static String username;
    private static String password;

    //2.定义方法:链接成功数据库 文件路径传入
    public static void getParam(String fileName) throws IOException {
        //2.1读取db_mysql.properties文件 -- Properties类读取文件键和值
        Properties p = new Properties();
        InputStream fis =
                oracle.class.getClassLoader().getResourceAsStream(fileName);
        p.load(fis);
        url = p.getProperty("url");
        username = p.getProperty("username");
        password = p.getProperty("password");
        System.out.println("数据库基本信息:" + url + username + password);
    }

    public static void main(String[] args) throws IOException {
        oracle.getParam("db_oracle.properties");
    }
}